<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title>动态列表 - 社交圈</title>
  <!-- Bootstrap 5 CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
  
  <style>
    :root {
      --primary: #3B82F6;
      --primary-light: #EFF6FF;
      --text-primary: #1F2937;
      --text-secondary: #6B7280;
      --bg-light: #F9FAFB;
      --bg-white: #FFFFFF;
      --border-light: #E5E7EB;
      --red: #EF4444;
    }
    
    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      background-color: var(--bg-light);
      color: var(--text-primary);
      line-height: 1.6;
      padding-top: 56px;
      padding-bottom: 70px;
      font-size: 15px;
    }
    
    /* 顶部导航 */
    .navbar {
      background-color: var(--bg-white);
      box-shadow: 0 2px 4px rgba(0,0,0,0.05);
      padding: 0.75rem 1rem;
    }
    
    .navbar-brand {
      color: var(--text-primary);
      font-weight: 600;
      font-size: 18px;
    }
    
    .nav-link {
      color: var(--text-primary);
      padding: 0.5rem;
    }
    
    /* 动态列表容器 */
    .feed-container {
      padding: 10px 0;
    }
    
    /* 动态项 */
    .feed-item {
      background-color: var(--bg-white);
      margin-bottom: 10px;
      padding: 15px;
    }
    
    /* 动态头部 */
    .feed-header {
      display: flex;
      margin-bottom: 12px;
    }
    
    .user-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      object-fit: cover;
      margin-right: 10px;
    }
    
    .user-info {
      flex: 1;
    }
    
    .user-name {
      font-weight: 600;
      font-size: 15px;
      margin-bottom: 2px;
    }
    
    .post-time {
      font-size: 12px;
      color: var(--text-secondary);
      display: flex;
      align-items: center;
    }
    
    .post-source {
      font-size: 12px;
      color: var(--primary);
      background-color: var(--primary-light);
      padding: 0 5px;
      border-radius: 3px;
      margin-left: 5px;
    }
    
    .menu-btn {
      color: var(--text-secondary);
      font-size: 16px;
    }
    
    /* 动态内容 */
    .post-content {
      margin-bottom: 12px;
      line-height: 1.5;
    }
    
    /* 图片容器 */
    .post-images {
      margin-bottom: 12px;
      border-radius: 8px;
      overflow: hidden;
    }
    
    /* 单张图片 */
    .single-image {
      width: 100%;
      aspect-ratio: 16/9;
      object-fit: cover;
    }
    
    /* 多张图片 - 网格布局 */
    .image-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 3px;
    }
    
    .image-grid-3 {
      grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-image {
      aspect-ratio: 1;
      object-fit: cover;
    }
    
    /* 动态底部操作区 */
    .post-actions {
      display: flex;
      justify-content: space-around;
      padding-top: 8px;
      border-top: 1px solid var(--border-light);
    }
    
    .action-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      color: var(--text-secondary);
      font-size: 14px;
      padding: 5px 0;
      flex: 1;
      transition: all 0.2s;
      background: none;
      border: none;
    }
    
    .action-btn:hover {
      color: var(--primary);
    }
    
    .action-btn.active {
      color: var(--red);
    }
    
    /* 评论区 */
    .comments-section {
      margin-top: 15px;
      border-top: 1px solid var(--border-light);
      padding-top: 15px;
    }
    
    .comments-header {
      display: flex;
      justify-content: space-between;
      margin-bottom: 15px;
      font-size: 14px;
    }
    
    .comments-count {
      color: var(--text-secondary);
      font-weight: 500;
    }
    
    .sort-comments {
      color: var(--primary);
      display: flex;
      align-items: center;
      gap: 4px;
    }
    
    /* 评论项 */
    .comment-item {
      display: flex;
      margin-bottom: 15px;
    }
    
    .comment-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      object-fit: cover;
      margin-right: 10px;
      flex-shrink: 0;
    }
    
    .comment-content {
      flex: 1;
      background-color: var(--bg-light);
      border-radius: 18px;
      padding: 10px 14px;
      position: relative;
    }
    
    .comment-header {
      display: flex;
      justify-content: space-between;
      margin-bottom: 5px;
    }
    
    .comment-author {
      font-weight: 600;
      font-size: 14px;
    }
    
    .comment-time {
      font-size: 12px;
      color: var(--text-secondary);
      margin-left: 10px;
    }
    
    .comment-text {
      font-size: 14px;
      margin-bottom: 6px;
    }
    
    .comment-actions {
      display: flex;
      gap: 15px;
      font-size: 12px;
    }
    
    .comment-action {
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      gap: 3px;
    }
    
    .comment-action:hover {
      color: var(--primary);
      cursor: pointer;
    }
    
    /* 回复区 */
    .replies-section {
      margin-top: 10px;
      margin-left: 46px; /* 头像宽度 + 间距 */
    }
    
    .reply-item {
      display: flex;
      margin-bottom: 10px;
    }
    
    .reply-content {
      flex: 1;
      background-color: var(--bg-light);
      border-radius: 16px;
      padding: 8px 12px;
    }
    
    .reply-author {
      font-weight: 600;
      font-size: 13px;
    }
    
    .reply-to {
      color: var(--text-secondary);
      margin: 0 5px;
    }
    
    .reply-text {
      font-size: 13px;
      margin-bottom: 4px;
    }
    
    /* 评论输入框 */
    .comment-input-container {
      display: flex;
      align-items: center;
      margin-top: 10px;
      gap: 10px;
    }
    
    .comment-input {
      flex: 1;
      background-color: var(--bg-light);
      border: none;
      border-radius: 20px;
      padding: 10px 15px;
      font-size: 14px;
      outline: none;
    }
    
    .send-comment {
      color: var(--primary);
      font-size: 18px;
    }
    
    /* 底部发布按钮 */
    .post-button {
      position: fixed;
      bottom: 20px;
      right: 20px;
      width: 55px;
      height: 55px;
      border-radius: 50%;
      background-color: var(--primary);
      color: white;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
      border: none;
      z-index: 10;
    }
  </style>
</head>
<body>
  <!-- 顶部导航 -->
  <nav class="navbar navbar-light fixed-top">
    <div class="container-fluid">
      <a class="nav-link" href="#" aria-label="首页">
        <i class="fa fa-home"></i>
      </a>
      <span class="navbar-brand mb-0">动态</span>
      <a class="nav-link" href="#" aria-label="通知">
        <i class="fa fa-bell-o"></i>
      </a>
    </div>
  </nav>
  
  <!-- 动态列表容器 -->
  <div class="feed-container">
    <!-- 1. 无图动态（带评论和回复） -->
    <div class="feed-item">
      <div class="feed-header">
        <img src="https://picsum.photos/200/200?random=1" alt="用户头像" class="user-avatar">
        <div class="user-info">
          <div class="user-name">张小明</div>
          <div class="post-time">
            2小时前
            <span class="post-source">原创</span>
          </div>
        </div>
        <a href="#" class="menu-btn">
          <i class="fa fa-ellipsis-h"></i>
        </a>
      </div>
      
      <div class="post-content">
        今天发布了我们团队的新产品，经过半年的努力终于和大家见面了！感谢团队所有人的付出，也感谢用户一直以来的支持。希望这个产品能给大家带来更好的体验，欢迎大家试用并提出宝贵意见！
      </div>
      
      <div class="post-actions">
        <button class="action-btn comment-btn" data-target="comments-1">
          <i class="fa fa-comment-o"></i>
          <span>5</span>
        </button>
        <button class="action-btn">
          <i class="fa fa-retweet"></i>
          <span>15</span>
        </button>
        <button class="action-btn active">
          <i class="fa fa-heart"></i>
          <span>89</span>
        </button>
        <button class="action-btn">
          <i class="fa fa-share-alt"></i>
        </button>
      </div>
      
      <!-- 评论区 -->
      <div class="comments-section" id="comments-1">
        <div class="comments-header">
          <div class="comments-count">5条评论</div>
          <div class="sort-comments">
            <span>最新</span>
            <i class="fa fa-chevron-down"></i>
          </div>
        </div>
        
        <!-- 评论1 -->
        <div class="comment-item">
          <img src="https://picsum.photos/200/200?random=10" alt="评论用户头像" class="comment-avatar">
          <div class="comment-content">
            <div class="comment-header">
              <span class="comment-author">李开发</span>
              <span class="comment-time">1小时前</span>
            </div>
            <div class="comment-text">恭喜发布！产品看起来很棒，已经下载试用了，界面设计很用心</div>
            <div class="comment-actions">
              <div class="comment-action like-comment">
                <i class="fa fa-heart-o"></i> 12
              </div>
              <div class="comment-action reply-to-comment">回复</div>
            </div>
            
            <!-- 回复区 -->
            <div class="replies-section">
              <div class="reply-item">
                <img src="https://picsum.photos/200/200?random=1" alt="回复用户头像" class="comment-avatar">
                <div class="reply-content">
                  <div class="comment-header">
                    <span class="comment-author">张小明</span>
                    <span class="comment-time">45分钟前</span>
                  </div>
                  <div class="comment-text">
                    <span class="reply-author">张小明</span>
                    <span class="reply-to">回复</span>
                    <span class="reply-author">李开发</span>
                    ：感谢支持！我们会持续优化产品体验的
                  </div>
                  <div class="comment-actions">
                    <div class="comment-action like-comment">
                      <i class="fa fa-heart-o"></i> 3
                    </div>
                    <div class="comment-action reply-to-comment">回复</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 评论2 -->
        <div class="comment-item">
          <img src="https://picsum.photos/200/200?random=11" alt="评论用户头像" class="comment-avatar">
          <div class="comment-content">
            <div class="comment-header">
              <span class="comment-author">王产品</span>
              <span class="comment-time">1.5小时前</span>
            </div>
            <div class="comment-text">半年时间能做出这么完整的产品，团队效率太高了！期待后续的功能更新</div>
            <div class="comment-actions">
              <div class="comment-action like-comment">
                <i class="fa fa-heart-o"></i> 8
              </div>
              <div class="comment-action reply-to-comment">回复</div>
            </div>
          </div>
        </div>
        
        <!-- 评论输入框 -->
        <div class="comment-input-container">
          <img src="https://picsum.photos/200/200?random=99" alt="当前用户头像" class="comment-avatar">
          <input type="text" class="comment-input" placeholder="添加评论...">
          <div class="send-comment">
            <i class="fa fa-paper-plane-o"></i>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 2. 单图动态（带评论） -->
    <div class="feed-item">
      <div class="feed-header">
        <img src="https://picsum.photos/200/200?random=2" alt="用户头像" class="user-avatar">
        <div class="user-info">
          <div class="user-name">李美食</div>
          <div class="post-time">
            昨天 18:30
            <span class="post-source">原创</span>
          </div>
        </div>
        <a href="#" class="menu-btn">
          <i class="fa fa-ellipsis-h"></i>
        </a>
      </div>
      
      <div class="post-content">
        周末在家尝试做了红烧肉，第一次做，没想到这么成功！分享一下成果，味道真的不错，做法放在评论区了~
      </div>
      
      <div class="post-images">
        <img src="https://picsum.photos/600/400?random=20" alt="红烧肉图片" class="single-image">
      </div>
      
      <div class="post-actions">
        <button class="action-btn comment-btn" data-target="comments-2">
          <i class="fa fa-comment-o"></i>
          <span>12</span>
        </button>
        <button class="action-btn">
          <i class="fa fa-retweet"></i>
          <span>8</span>
        </button>
        <button class="action-btn active">
          <i class="fa fa-heart"></i>
          <span>67</span>
        </button>
        <button class="action-btn">
          <i class="fa fa-share-alt"></i>
        </button>
      </div>
      
      <!-- 评论区 -->
      <div class="comments-section" id="comments-2">
        <div class="comments-header">
          <div class="comments-count">12条评论</div>
          <div class="sort-comments">
            <span>最新</span>
            <i class="fa fa-chevron-down"></i>
          </div>
        </div>
        
        <!-- 评论1 -->
        <div class="comment-item">
          <img src="https://picsum.photos/200/200?random=21" alt="评论用户头像" class="comment-avatar">
          <div class="comment-content">
            <div class="comment-header">
              <span class="comment-author">张厨师</span>
              <span class="comment-time">昨天 19:05</span>
            </div>
            <div class="comment-text">色泽看起来非常好！第一次做就能有这水平太厉害了，请问用的什么酱油？</div>
            <div class="comment-actions">
              <div class="comment-action like-comment">
                <i class="fa fa-heart-o"></i> 5
              </div>
              <div class="comment-action reply-to-comment">回复</div>
            </div>
            
            <!-- 回复区 -->
            <div class="replies-section">
              <div class="reply-item">
                <img src="https://picsum.photos/200/200?random=2" alt="回复用户头像" class="comment-avatar">
                <div class="reply-content">
                  <div class="comment-header">
                    <span class="comment-author">李美食</span>
                    <span class="comment-time">昨天 19:12</span>
                  </div>
                  <div class="comment-text">
                    <span class="reply-author">李美食</span>
                    <span class="reply-to">回复</span>
                    <span class="reply-author">张厨师</span>
                    ：用的是老抽和冰糖调的色，没有放太多调料
                  </div>
                  <div class="comment-actions">
                    <div class="comment-action like-comment">
                      <i class="fa fa-heart-o"></i> 2
                    </div>
                    <div class="comment-action reply-to-comment">回复</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 评论2 -->
        <div class="comment-item">
          <img src="https://picsum.photos/200/200?random=22" alt="评论用户头像" class="comment-avatar">
          <div class="comment-content">
            <div class="comment-header">
              <span class="comment-author">赵吃货</span>
              <span class="comment-time">昨天 18:45</span>
            </div>
            <div class="comment-text">求做法！看起来太有食欲了，周末也想试试</div>
            <div class="comment-actions">
              <div class="comment-action like-comment">
                <i class="fa fa-heart-o"></i> 9
              </div>
              <div class="comment-action reply-to-comment">回复</div>
            </div>
            
            <!-- 回复区 -->
            <div class="replies-section">
              <div class="reply-item">
                <img src="https://picsum.photos/200/200?random=2" alt="回复用户头像" class="comment-avatar">
                <div class="reply-content">
                  <div class="comment-header">
                    <span class="comment-author">李美食</span>
                    <span class="comment-time">昨天 18:50</span>
                  </div>
                  <div class="comment-text">
                    <span class="reply-author">李美食</span>
                    <span class="reply-to">回复</span>
                    <span class="reply-author">赵吃货</span>
                    ：做法很简单：1. 五花肉切块焯水；2. 热油炒糖色；3. 放肉翻炒上色；4. 加调料和热水焖煮40分钟；5. 收汁即可
                  </div>
                  <div class="comment-actions">
                    <div class="comment-action like-comment">
                      <i class="fa fa-heart-o"></i> 15
                    </div>
                    <div class="comment-action reply-to-comment">回复</div>
                  </div>
                </div>
              </div>
              
              <div class="reply-item">
                <img src="https://picsum.photos/200/200?random=23" alt="回复用户头像" class="comment-avatar">
                <div class="reply-content">
                  <div class="comment-header">
                    <span class="comment-author">孙厨房</span>
                    <span class="comment-time">昨天 19:20</span>
                  </div>
                  <div class="comment-text">
                    <span class="reply-author">孙厨房</span>
                    <span class="reply-to">回复</span>
                    <span class="reply-author">李美食</span>
                    ：建议焖煮时加一点山楂片，肉会更烂，也解腻
                  </div>
                  <div class="comment-actions">
                    <div class="comment-action like-comment">
                      <i class="fa fa-heart-o"></i> 7
                    </div>
                    <div class="comment-action reply-to-comment">回复</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 评论输入框 -->
        <div class="comment-input-container">
          <img src="https://picsum.photos/200/200?random=99" alt="当前用户头像" class="comment-avatar">
          <input type="text" class="comment-input" placeholder="添加评论...">
          <div class="send-comment">
            <i class="fa fa-paper-plane-o"></i>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 3. 多图动态（3张）带评论 -->
    <div class="feed-item">
      <div class="feed-header">
        <img src="https://picsum.photos/200/200?random=3" alt="用户头像" class="user-avatar">
        <div class="user-info">
          <div class="user-name">王旅行</div>
          <div class="post-time">
            3天前
            <span class="post-source">原创</span>
          </div>
        </div>
        <a href="#" class="menu-btn">
          <i class="fa fa-ellipsis-h"></i>
        </a>
      </div>
      
      <div class="post-content">
        上周去了云南大理，风景真的太美了！随手一拍都是壁纸，分享几张照片给大家~ 有没有去过的朋友推荐一下小众景点？
      </div>
      
      <div class="post-images">
        <div class="image-grid image-grid-3">
          <img src="https://picsum.photos/300/300?random=30" alt="大理风景1" class="grid-image">
          <img src="https://picsum.photos/300/300?random=31" alt="大理风景2" class="grid-image">
          <img src="https://picsum.photos/300/300?random=32" alt="大理风景3" class="grid-image">
        </div>
      </div>
      
      <div class="post-actions">
        <button class="action-btn comment-btn" data-target="comments-3">
          <i class="fa fa-comment-o"></i>
          <span>23</span>
        </button>
        <button class="action-btn">
          <i class="fa fa-retweet"></i>
          <span>34</span>
        </button>
        <button class="action-btn active">
          <i class="fa fa-heart"></i>
          <span>215</span>
        </button>
        <button class="action-btn">
          <i class="fa fa-share-alt"></i>
        </button>
      </div>
      
      <!-- 评论区 -->
      <div class="comments-section" id="comments-3">
        <div class="comments-header">
          <div class="comments-count">23条评论</div>
          <div class="sort-comments">
            <span>最新</span>
            <i class="fa fa-chevron-down"></i>
          </div>
        </div>
        
        <!-- 评论1 -->
        <div class="comment-item">
          <img src="https://picsum.photos/200/200?random=33" alt="评论用户头像" class="comment-avatar">
          <div class="comment-content">
            <div class="comment-header">
              <span class="comment-author">刘导游</span>
              <span class="comment-time">3天前</span>
            </div>
            <div class="comment-text">推荐去沙溪古镇，比大理古城安静很多，保留了更多原始风貌，适合喜欢清净的游客</div>
            <div class="comment-actions">
              <div class="comment-action like-comment">
                <i class="fa fa-heart-o"></i> 42
              </div>
              <div class="comment-action reply-to-comment">回复</div>
            </div>
          </div>
        </div>
        
        <!-- 评论2 -->
        <div class="comment-item">
          <img src="https://picsum.photos/200/200?random=34" alt="评论用户头像" class="comment-avatar">
          <div class="comment-content">
            <div class="comment-header">
              <span class="comment-author">陈摄影</span>
              <span class="comment-time">3天前</span>
            </div>
            <div class="comment-text">第三张照片是在哪里拍的？光线和构图都太棒了！</div>
            <div class="comment-actions">
              <div class="comment-action like-comment">
                <i class="fa fa-heart-o"></i> 18
              </div>
              <div class="comment-action reply-to-comment">回复</div>
            </div>
            
            <!-- 回复区 -->
            <div class="replies-section">
              <div class="reply-item">
                <img src="https://picsum.photos/200/200?random=3" alt="回复用户头像" class="comment-avatar">
                <div class="reply-content">
                  <div class="comment-header">
                    <span class="comment-author">王旅行</span>
                    <span class="comment-time">3天前</span>
                  </div>
                  <div class="comment-text">
                    <span class="reply-author">王旅行</span>
                    <span class="reply-to">回复</span>
                    <span class="reply-author">陈摄影</span>
                    ：是在洱海西岸的生态廊道拍的，早上9点左右，光线刚好
                  </div>
                  <div class="comment-actions">
                    <div class="comment-action like-comment">
                      <i class="fa fa-heart-o"></i> 8
                    </div>
                    <div class="comment-action reply-to-comment">回复</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 评论输入框 -->
        <div class="comment-input-container">
          <img src="https://picsum.photos/200/200?random=99" alt="当前用户头像" class="comment-avatar">
          <input type="text" class="comment-input" placeholder="添加评论...">
          <div class="send-comment">
            <i class="fa fa-paper-plane-o"></i>
          </div>
        </div>
      </div>
    </div>
  </div>
  
  <!-- 发布按钮 -->
  <button class="post-button" aria-label="发布动态">
    <i class="fa fa-plus"></i>
  </button>
  
  <!-- Bootstrap JS -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  
  <script>
    // 评论区展开/折叠功能
    document.querySelectorAll('.comment-btn').forEach(btn => {
      const targetId = btn.getAttribute('data-target');
      const commentsSection = document.getElementById(targetId);
      
      // 默认隐藏评论区
      commentsSection.style.display = 'none';
      
      btn.addEventListener('click', function() {
        // 切换评论区显示状态
        if (commentsSection.style.display === 'none') {
          commentsSection.style.display = 'block';
          // 平滑滚动到评论区
          commentsSection.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
        } else {
          commentsSection.style.display = 'none';
        }
      });
    });
    
    // 点赞按钮交互
    document.querySelectorAll('.action-btn').forEach(btn => {
      btn.addEventListener('click', function(e) {
        // 如果是评论按钮则不执行点赞逻辑
        if (this.classList.contains('comment-btn')) return;
        
        // 点赞按钮切换状态
        if (this.querySelector('.fa-heart') || this.querySelector('.fa-heart-o')) {
          e.stopPropagation();
          this.classList.toggle('active');
          const icon = this.querySelector('i');
          if (this.classList.contains('active')) {
            icon.className = 'fa fa-heart';
          } else {
            icon.className = 'fa fa-heart-o';
          }
          
          // 更新数字
          const countEl = this.querySelector('span');
          if (countEl) {
            let count = parseInt(countEl.textContent);
            count = this.classList.contains('active') ? count + 1 : count - 1;
            countEl.textContent = count;
          }
        }
      });
    });
    
    // 评论点赞功能
    document.querySelectorAll('.like-comment').forEach(btn => {
      btn.addEventListener('click', function() {
        const icon = this.querySelector('i');
        const countText = this.childNodes[2].textContent.trim();
        let count = parseInt(countText);
        
        if (icon.classList.contains('fa-heart-o')) {
          icon.className = 'fa fa-heart';
          this.style.color = 'var(--red)';
          this.childNodes[2].textContent = ` ${count + 1}`;
        } else {
          icon.className = 'fa fa-heart-o';
          this.style.color = '';
          this.childNodes[2].textContent = ` ${count - 1}`;
        }
      });
    });
    
    // 回复功能
    document.querySelectorAll('.reply-to-comment').forEach(btn => {
      btn.addEventListener('click', function() {
        const commentItem = this.closest('.comment-item, .reply-item');
        const authorName = commentItem.querySelector('.comment-author').textContent;
        const inputContainer = commentItem.closest('.comments-section').querySelector('.comment-input-container');
        const input = inputContainer.querySelector('.comment-input');
        
        // 聚焦到输入框并填充回复前缀
        input.value = `回复 @${authorName}：`;
        input.focus();
        
        // 滚动到输入框
        inputContainer.scrollIntoView({ behavior: 'smooth', block: 'center' });
      });
    });
    
    // 发送评论功能
    document.querySelectorAll('.send-comment').forEach(btn => {
      btn.addEventListener('click', sendComment);
    });
    
    // 回车发送评论
    document.querySelectorAll('.comment-input').forEach(input => {
      input.addEventListener('keypress', function(e) {
        if (e.key === 'Enter') {
          sendComment.call(this);
        }
      });
    });
    
    // 发送评论函数
    function sendComment() {
      const input = this.closest('.comment-input-container').querySelector('.comment-input');
      const commentText = input.value.trim();
      
      if (!commentText) return;
      
      const commentsSection = this.closest('.comments-section');
      const commentsList = commentsSection.querySelector('.comments-header').nextElementSibling;
      
      // 创建新评论元素
      const newComment = document.createElement('div');
      newComment.className = 'comment-item';
      newComment.innerHTML = `
        <img src="https://picsum.photos/200/200?random=99" alt="当前用户头像" class="comment-avatar">
        <div class="comment-content">
          <div class="comment-header">
            <span class="comment-author">我</span>
            <span class="comment-time">刚刚</span>
          </div>
          <div class="comment-text">${commentText}</div>
          <div class="comment-actions">
            <div class="comment-action like-comment">
              <i class="fa fa-heart-o"></i> 0
            </div>
            <div class="comment-action reply-to-comment">回复</div>
          </div>
        </div>
      `;
      
      // 添加新评论到列表顶部
      if (commentsList) {
        commentsSection.insertBefore(newComment, commentsList);
      } else {
        commentsSection.insertBefore(newComment, commentsSection.querySelector('.comment-input-container'));
      }
      
      // 更新评论计数
      const countEl = commentsSection.querySelector('.comments-count');
      const countText = countEl.textContent;
      const count = parseInt(countText.match(/\d+/)[0]);
      countEl.textContent = countText.replace(/\d+/, count + 1);
      
      // 更新按钮计数
      const commentBtn = document.querySelector(`.comment-btn[data-target="${commentsSection.id}"] span`);
      commentBtn.textContent = parseInt(commentBtn.textContent) + 1;
      
      // 清空输入框
      input.value = '';
      
      // 绑定新评论的事件
      newComment.querySelector('.like-comment').addEventListener('click', function() {
        const icon = this.querySelector('i');
        const countText = this.childNodes[2].textContent.trim();
        let count = parseInt(countText || 0);
        
        if (icon.classList.contains('fa-heart-o')) {
          icon.className = 'fa fa-heart';
          this.style.color = 'var(--red)';
          this.childNodes[2].textContent = ` ${count + 1}`;
        } else {
          icon.className = 'fa fa-heart-o';
          this.style.color = '';
          this.childNodes[2].textContent = ` ${count - 1}`;
        }
      });
      
      newComment.querySelector('.reply-to-comment').addEventListener('click', function() {
        // 回复功能逻辑
      });
    }
    
    // 发布按钮点击事件
    document.querySelector('.post-button').addEventListener('click', function() {
      alert('打开发布动态界面');
    });
  </script>
</body>
</html>
